package com.sy.simpleegg.adapter

import android.annotation.SuppressLint
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.BaseAdapter
import com.sy.simpleegg.databinding.ItemSpinnerBinding

class BackstageAdapter(val items: MutableList<String>):
    BaseAdapter() {

    override fun getCount(): Int {
        return items.size
    }

    override fun getItem(position: Int): Any {
        return items[position]
    }

    override fun getItemId(position: Int): Long {
        return position.toLong()
    }

    @SuppressLint("ViewHolder")
    override fun getView(position: Int, convertView: View?, parent: ViewGroup?): View {
        val binding = ItemSpinnerBinding.inflate(LayoutInflater.from(parent!!.context), parent, false)
        binding.tvName.text = items[position].split(",")[1]
        return binding.root
    }
}